/*
 * Zam11.java
 *
 * Created on November 14, 2005, 8:09 PM
 */
/* */
import java.io.*;
import java.util.Enumeration;
import javax.microedition.io.*;
import javax.microedition.io.file.FileConnection;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

/**
 *
 * @author Administrator
 */
public class CellularBASIC extends MIDlet implements javax.microedition.lcdui.CommandListener, java.lang.Runnable, javax.microedition.lcdui.ItemCommandListener {
    GraphixScreen gScreen = null; // handle to graphix screen
    Parser parser = null; // handle to parser
    Display display = null; // handle to current display
    Thread pilotThread = null; // main parsing thread

    
    /** Creates a new instance of Zam11 */
    public CellularBASIC() {

    }
    
    private TextBox srcTextBox;//GEN-BEGIN:MVDFields
    private Command crCommand;
    private Command runCommand;
    private Command newCommand;
    private Command exitCommand;
    private Form outForm;
    private TextField inTextField;
    private TextField outTextField;
    private Command enterCommand;
    private Command readCommand1;
    private Command itemCommand1;
    private Command outputCommand;
    private Command itemCommand2;
    private Command itemCommand3;
    private Command loadCommand;
    private List fileList;
    private Command backCommand1;
    private Command itemCommand4;
    private Command readCommand;
    private Command itemCommand5;
    private Command itemCommand6;
    private Command itemCommand7;
    private Command backCommand2;
    private Command backCommand3;
    private Command srcCommand4;
    private Command drawCommand;
    private Command graphBoard;
    private Command backCommand5;
    private Command backCommand6;
    private Command backCommand7;
    private Command screenCommand1;
    private Command okCommand1;
    private Command proceedCommand;
    private Command itemCommand9;
    private Command itemCommand10;
    private Command screenCommand2;
    private Command grphxCommand;
    private Command itemCommand8;
    private Command saveCommand;
    private Command cleanCommand;
    private Command stopCommand1;
    private Command okCommand2;
    private Command readCommand2;
    private Form saveForm;
    private TextField saveTextField;
    private Command okCommand3;
    private Command cancelCommand1;
    private Command backCommand4;
    private Command readCommand3;
    private List menuScreen;
    private Command itemCommand11;
    private Command menuCommand1;
    private Command menuCommand2;
    private Command backCommand8;
    private Command backCommand9;
    private Command cancelCommand2;
    private Command helpCommand1;
    private Command okCommand4;
    private Command screenCommand3;
    private Command okCommand5;
    private Command Goto;
    private Command itemCommand12;
    private Form JumpingForm;
    private Command okCommand6;
    private Command cancelCommand3;
    private Command itemCommand13;
    private Command itemCommand14;
    private Command itemCommand15;
    private Command itemCommand16;
    private Command Search;
    private Command FindNext;
    private Command FindNext1;
    private TextField GotoLineField;
    private TextField SearchStringField;
    private Command cancelCommand4;
    private Command FindNext2;
    private Command okCommand7;
    private Command Save;//GEN-END:MVDFields

//GEN-LINE:MVDMethods

    /** This method initializes UI of the application.//GEN-BEGIN:MVDInitBegin
     */
    private void initialize() {//GEN-END:MVDInitBegin
    
  
// Insert pre-init code here
        srcTextBox = new TextBox("Source Editor", "", 32000, TextField.ANY);//GEN-BEGIN:MVDInitInit
        srcTextBox.addCommand(get_Goto());
        srcTextBox.addCommand(get_cancelCommand4());
        srcTextBox.addCommand(get_FindNext2());
        srcTextBox.addCommand(get_Save());
        srcTextBox.setCommandListener(this);
        getDisplay().setCurrent(get_menuScreen());//GEN-END:MVDInitInit
    }//GEN-LINE:MVDInitEnd
    /**
     * This method should return an instance of the display.
     */
    public Display getDisplay () {//GEN-FIRST:MVDGetDisplay
        return Display.getDisplay (this);
    }//GEN-LAST:MVDGetDisplay

    /**
     * This method should exit the midlet.
     */
    public void exitMIDlet () {//GEN-FIRST:MVDExitMidlet
        getDisplay ().setCurrent (null);
        destroyApp (true);
        notifyDestroyed ();
    }//GEN-LAST:MVDExitMidlet
/* jump to indicated line number */
private void JumpTo(int GoLine, TextBox tb) {
    String s = tb.getString();
    int start = 0;
    for (long line=1;line < GoLine;line++) {
        start = s.indexOf('\n', start);
        if (start < 0)
            break;
        else
            start++;
    }
    tb.insert("", start);
}
public void JumpTo(int GoLine, int GoColumn, TextBox tb) {
    JumpTo(GoLine, tb);
    tb.insert("", tb.getCaretPosition()+GoColumn);
}
private void JumpTo(String GoString, TextBox tb, int startPos) {
    String s = tb.getString();
    int start = s.indexOf(GoString, startPos);
    tb.insert("", start);
}
/** Called by the system to indicate that a command has been invoked on a particular item.//GEN-BEGIN:MVDICABegin
 * @param command the Command that ws invoked
 * @param item the Item on which the command was invoked
 */
public void commandAction(Command command, Item item) {//GEN-END:MVDICABegin
    // Insert global pre-action code here
    if (item == inTextField) {//GEN-BEGIN:MVDICABody
        if (command == enterCommand) {//GEN-END:MVDICABody
                // Insert pre-action code here
            // Do nothing//GEN-LINE:MVDICAAction12
                enter();
        }//GEN-BEGIN:MVDICACase12
    }//GEN-END:MVDICACase12
    // Insert global post-action code here
}//GEN-LINE:MVDICAEnd

/** Called by the system to indicate that a command has been invoked on a particular displayable.//GEN-BEGIN:MVDCABegin
 * @param command the Command that ws invoked
 * @param displayable the Displayable on which the command was invoked
 */
public void commandAction(Command command, Displayable displayable) {//GEN-END:MVDCABegin
    // Insert global pre-action code here
    if (displayable == menuScreen) {//GEN-BEGIN:MVDCABody
        if (command == menuScreen.SELECT_COMMAND) {
            switch (get_menuScreen().getSelectedIndex()) {
                case 0://GEN-END:MVDCABody
                        // Insert pre-action code here
                    // Do nothing//GEN-LINE:MVDCAAction66
                        // Insert post-action code here
                    break;//GEN-BEGIN:MVDCACase66
                case 1://GEN-END:MVDCACase66
                        // Insert pre-action code here
                    getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction62
                        prepareNew();
                        break;//GEN-BEGIN:MVDCACase62
                case 2://GEN-END:MVDCACase62
                        // Insert pre-action code here
                    // Do nothing//GEN-LINE:MVDCAAction76
                        run();
                        break;//GEN-BEGIN:MVDCACase76
                case 3://GEN-END:MVDCACase76
                        // Insert pre-action code here
                    getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction83
                        // Insert post-action code here
                    break;//GEN-BEGIN:MVDCACase83
                case 4://GEN-END:MVDCACase83
                        // Insert pre-action code here
                    getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction74
                        // Insert post-action code here
                    break;//GEN-BEGIN:MVDCACase74
                case 5://GEN-END:MVDCACase74
                        // Insert pre-action code here
                    // Do nothing//GEN-LINE:MVDCAAction72
                        Display.getDisplay(this).setCurrent(gScreen);
                        break;//GEN-BEGIN:MVDCACase72
                case 6://GEN-END:MVDCACase72
                        // Insert pre-action code here
                    getDisplay().setCurrent(get_outForm());//GEN-LINE:MVDCAAction70
                        // Insert post-action code here
                    break;//GEN-BEGIN:MVDCACase70
                case 7://GEN-END:MVDCACase70
                    prepareLoad();
                    // Insert pre-action code here
                    getDisplay().setCurrent(get_fileList());//GEN-LINE:MVDCAAction60

                    break;//GEN-BEGIN:MVDCACase60
                case 8://GEN-END:MVDCACase60
                        // Insert pre-action code here
                    getDisplay().setCurrent(get_saveForm());//GEN-LINE:MVDCAAction68
                        // Insert post-action code here
                    break;//GEN-BEGIN:MVDCACase68
                case 9://GEN-END:MVDCACase68
                        // Insert pre-action code here
                    // Do nothing//GEN-LINE:MVDCAAction64
                        // Insert post-action code here
                    break;//GEN-BEGIN:MVDCACase64
                case 10://GEN-END:MVDCACase64
                        // Insert pre-action code here
                    exitMIDlet();//GEN-LINE:MVDCAAction85
                        // Insert post-action code here
                    break;//GEN-BEGIN:MVDCACase85
            }
        }
    } else if (displayable == outForm) {
        if (command == menuCommand2) {//GEN-END:MVDCACase85
                // Insert pre-action code here
            getDisplay().setCurrent(get_menuScreen());//GEN-LINE:MVDCAAction81
                // Insert post-action code here
        }//GEN-BEGIN:MVDCACase81
    } else if (displayable == srcTextBox) {
        if (command == Goto) {//GEN-END:MVDCACase81
            getDisplay().setCurrent(get_JumpingForm());//GEN-LINE:MVDCAAction94
                // Insert post-action code here
        } else if (command == cancelCommand4) {//GEN-LINE:MVDCACase94
                // Insert pre-action code here
            getDisplay().setCurrent(get_menuScreen());//GEN-LINE:MVDCAAction120
                // Insert post-action code here
        } else if (command == FindNext2) {//GEN-LINE:MVDCACase120
                // Insert pre-action code here
                if (srcTextBox.size() > 0 && SearchStringField.size() > 0) {
                    JumpTo(SearchStringField.getString(), srcTextBox, srcTextBox.getCaretPosition()+1);
                }
                getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction122
                // Insert post-action code here
        } else if (command == Save) {//GEN-LINE:MVDCACase122
            // Insert pre-action code here
            if (get_saveTextField().getString() == null) {
                getDisplay().setCurrent(get_saveForm());
            } else {
            // Do nothing//GEN-LINE:MVDCAAction126
            prepareSave();
            }
            // Insert post-action code here
        }//GEN-BEGIN:MVDCACase126
    } else if (displayable == saveForm) {
        if (command == cancelCommand1) {//GEN-END:MVDCACase126
                // Insert pre-action code here
            getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction52
                // Insert post-action code here
        } else if (command == okCommand3) {//GEN-LINE:MVDCACase52
                // Insert pre-action code here
            getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction50
                prepareSave();
        }//GEN-BEGIN:MVDCACase50
    } else if (displayable == fileList) {
        if (command == readCommand3) {//GEN-END:MVDCACase50
                // Insert pre-action code here
            // Do nothing//GEN-LINE:MVDCAAction56
                read();
        } else if (command == backCommand4) {//GEN-LINE:MVDCACase56
                // Insert pre-action code here
            getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction54
                // Insert post-action code here
        }//GEN-BEGIN:MVDCACase54
    } else if (displayable == JumpingForm) {
        if (command == Goto) {//GEN-END:MVDCACase54
                long gotoLine = 0;
                if (SearchStringField.getString() != null) {
                    gotoLine = Long.parseLong(GotoLineField.getString());
                }
                JumpTo((int)gotoLine, srcTextBox);
                getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction102
                // Insert post-action code here
        } else if (command == Search) {//GEN-LINE:MVDCACase102
                // Insert pre-action code here
                if (SearchStringField.getString() != null) {
                    JumpTo(SearchStringField.getString(), srcTextBox, 0);
                }
                getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction111
                // Insert post-action code here
        } else if (command == FindNext1) {//GEN-LINE:MVDCACase111
                // Insert pre-action code here
                if (SearchStringField.getString() != null) {
                    JumpTo(SearchStringField.getString(), srcTextBox, srcTextBox.getCaretPosition()+1);
                }                    
                getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction115
                // Insert post-action code here
        } else if (command == cancelCommand3) {//GEN-LINE:MVDCACase115
                // Insert pre-action code here
            getDisplay().setCurrent(srcTextBox);//GEN-LINE:MVDCAAction104
                // Insert post-action code here
        }//GEN-BEGIN:MVDCACase104
    }//GEN-END:MVDCACase104
    // Insert global post-action code here
}//GEN-LINE:MVDCAEnd

/** This method returns instance for crCommand component and should be called instead of accessing crCommand field directly.//GEN-BEGIN:MVDGetBegin3
 * @return Instance for crCommand component
 */
public Command get_crCommand() {
    if (crCommand == null) {//GEN-END:MVDGetBegin3
            // Insert pre-init code here
        crCommand = new Command("CR", Command.ITEM, 1);//GEN-LINE:MVDGetInit3
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd3
    return crCommand;
}//GEN-END:MVDGetEnd3

/** This method returns instance for runCommand component and should be called instead of accessing runCommand field directly.//GEN-BEGIN:MVDGetBegin4
 * @return Instance for runCommand component
 */
public Command get_runCommand() {
    if (runCommand == null) {//GEN-END:MVDGetBegin4
            // Insert pre-init code here
        runCommand = new Command("Run", Command.ITEM, 1);//GEN-LINE:MVDGetInit4
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd4
    return runCommand;
}//GEN-END:MVDGetEnd4

/** This method returns instance for newCommand component and should be called instead of accessing newCommand field directly.//GEN-BEGIN:MVDGetBegin5
 * @return Instance for newCommand component
 */
public Command get_newCommand() {
    if (newCommand == null) {//GEN-END:MVDGetBegin5
            // Insert pre-init code here
        newCommand = new Command("New", Command.ITEM, 1);//GEN-LINE:MVDGetInit5
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd5
    return newCommand;
}//GEN-END:MVDGetEnd5

/** This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.//GEN-BEGIN:MVDGetBegin6
 * @return Instance for exitCommand component
 */
public Command get_exitCommand() {
    if (exitCommand == null) {//GEN-END:MVDGetBegin6
            // Insert pre-init code here
        exitCommand = new Command("Exit", Command.EXIT, 1);//GEN-LINE:MVDGetInit6
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd6
    return exitCommand;
}//GEN-END:MVDGetEnd6

/** This method returns instance for outForm component and should be called instead of accessing outForm field directly.//GEN-BEGIN:MVDGetBegin7
 * @return Instance for outForm component
 */
public Form get_outForm() {
    if (outForm == null) {//GEN-END:MVDGetBegin7
            // Insert pre-init code here
        outForm = new Form(null, new Item[] {//GEN-BEGIN:MVDGetInit7
            get_inTextField(),
            get_outTextField()
        });
        outForm.addCommand(get_menuCommand2());
        outForm.setCommandListener(this);//GEN-END:MVDGetInit7
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd7
    return outForm;
}//GEN-END:MVDGetEnd7

/** This method returns instance for inTextField component and should be called instead of accessing inTextField field directly.//GEN-BEGIN:MVDGetBegin8
 * @return Instance for inTextField component
 */
public TextField get_inTextField() {
    if (inTextField == null) {//GEN-END:MVDGetBegin8
            // Insert pre-init code here
        inTextField = new TextField("in", "", 120, TextField.ANY);//GEN-BEGIN:MVDGetInit8
        inTextField.addCommand(get_enterCommand());
        inTextField.setItemCommandListener(this);//GEN-END:MVDGetInit8

    }//GEN-BEGIN:MVDGetEnd8
    return inTextField;
}//GEN-END:MVDGetEnd8

/** This method returns instance for outTextField component and should be called instead of accessing outTextField field directly.//GEN-BEGIN:MVDGetBegin9
 * @return Instance for outTextField component
 */
public TextField get_outTextField() {
    if (outTextField == null) {//GEN-END:MVDGetBegin9
            // Insert pre-init code here
        outTextField = new TextField("out", "", 10000, TextField.ANY);//GEN-LINE:MVDGetInit9
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd9
    return outTextField;
}//GEN-END:MVDGetEnd9

/** This method returns instance for enterCommand component and should be called instead of accessing enterCommand field directly.//GEN-BEGIN:MVDGetBegin10
 * @return Instance for enterCommand component
 */
public Command get_enterCommand() {
    if (enterCommand == null) {//GEN-END:MVDGetBegin10
            // Insert pre-init code here
        enterCommand = new Command("enter", Command.CANCEL, 1);//GEN-LINE:MVDGetInit10
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd10
    return enterCommand;
}//GEN-END:MVDGetEnd10

/** This method returns instance for readCommand1 component and should be called instead of accessing readCommand1 field directly.//GEN-BEGIN:MVDGetBegin11
 * @return Instance for readCommand1 component
 */
public Command get_readCommand1() {
    if (readCommand1 == null) {//GEN-END:MVDGetBegin11
            // Insert pre-init code here
        readCommand1 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit11
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd11
    return readCommand1;
}//GEN-END:MVDGetEnd11

/** This method returns instance for itemCommand1 component and should be called instead of accessing itemCommand1 field directly.//GEN-BEGIN:MVDGetBegin13
 * @return Instance for itemCommand1 component
 */
public Command get_itemCommand1() {
    if (itemCommand1 == null) {//GEN-END:MVDGetBegin13
            // Insert pre-init code here
        itemCommand1 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit13
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd13
    return itemCommand1;
}//GEN-END:MVDGetEnd13

/** This method returns instance for outputCommand component and should be called instead of accessing outputCommand field directly.//GEN-BEGIN:MVDGetBegin14
 * @return Instance for outputCommand component
 */
public Command get_outputCommand() {
    if (outputCommand == null) {//GEN-END:MVDGetBegin14
            // Insert pre-init code here
        outputCommand = new Command("Output Screen", Command.ITEM, 1);//GEN-LINE:MVDGetInit14
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd14
    return outputCommand;
}//GEN-END:MVDGetEnd14

/** This method returns instance for itemCommand2 component and should be called instead of accessing itemCommand2 field directly.//GEN-BEGIN:MVDGetBegin15
 * @return Instance for itemCommand2 component
 */
public Command get_itemCommand2() {
    if (itemCommand2 == null) {//GEN-END:MVDGetBegin15
            // Insert pre-init code here
        itemCommand2 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit15
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd15
    return itemCommand2;
}//GEN-END:MVDGetEnd15

/** This method returns instance for itemCommand3 component and should be called instead of accessing itemCommand3 field directly.//GEN-BEGIN:MVDGetBegin16
 * @return Instance for itemCommand3 component
 */
public Command get_itemCommand3() {
    if (itemCommand3 == null) {//GEN-END:MVDGetBegin16
            // Insert pre-init code here
        itemCommand3 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit16
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd16
    return itemCommand3;
}//GEN-END:MVDGetEnd16

/** This method returns instance for loadCommand component and should be called instead of accessing loadCommand field directly.//GEN-BEGIN:MVDGetBegin17
 * @return Instance for loadCommand component
 */
public Command get_loadCommand() {
    if (loadCommand == null) {//GEN-END:MVDGetBegin17
            // Insert pre-init code here
        loadCommand = new Command("Load", "Load", Command.ITEM, 1);//GEN-LINE:MVDGetInit17
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd17
    return loadCommand;
}//GEN-END:MVDGetEnd17

/** This method returns instance for fileList component and should be called instead of accessing fileList field directly.//GEN-BEGIN:MVDGetBegin19
 * @return Instance for fileList component
 */
public List get_fileList() {
    if (fileList == null) {//GEN-END:MVDGetBegin19
            // Insert pre-init code here
        fileList = new List("Load", Choice.IMPLICIT, new String[0], new Image[0]);//GEN-BEGIN:MVDGetInit19
        fileList.addCommand(get_backCommand4());
        fileList.addCommand(get_readCommand3());
        fileList.setCommandListener(this);
        fileList.setSelectedFlags(new boolean[0]);
        fileList.setSelectCommand(get_readCommand3());//GEN-END:MVDGetInit19
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd19
    return fileList;
}//GEN-END:MVDGetEnd19

/** This method returns instance for backCommand1 component and should be called instead of accessing backCommand1 field directly.//GEN-BEGIN:MVDGetBegin20
 * @return Instance for backCommand1 component
 */
public Command get_backCommand1() {
    if (backCommand1 == null) {//GEN-END:MVDGetBegin20
            // Insert pre-init code here
        backCommand1 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit20
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd20
    return backCommand1;
}//GEN-END:MVDGetEnd20

/** This method returns instance for itemCommand4 component and should be called instead of accessing itemCommand4 field directly.//GEN-BEGIN:MVDGetBegin21
 * @return Instance for itemCommand4 component
 */
public Command get_itemCommand4() {
    if (itemCommand4 == null) {//GEN-END:MVDGetBegin21
            // Insert pre-init code here
        itemCommand4 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit21
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd21
    return itemCommand4;
}//GEN-END:MVDGetEnd21

/** This method returns instance for readCommand component and should be called instead of accessing readCommand field directly.//GEN-BEGIN:MVDGetBegin22
 * @return Instance for readCommand component
 */
public Command get_readCommand() {
    if (readCommand == null) {//GEN-END:MVDGetBegin22
            // Insert pre-init code here
        readCommand = new Command("Read", "Read", Command.ITEM, 1);//GEN-LINE:MVDGetInit22
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd22
    return readCommand;
}//GEN-END:MVDGetEnd22

/** This method returns instance for itemCommand5 component and should be called instead of accessing itemCommand5 field directly.//GEN-BEGIN:MVDGetBegin23
 * @return Instance for itemCommand5 component
 */
public Command get_itemCommand5() {
    if (itemCommand5 == null) {//GEN-END:MVDGetBegin23
            // Insert pre-init code here
        itemCommand5 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit23
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd23
    return itemCommand5;
}//GEN-END:MVDGetEnd23

/** This method returns instance for itemCommand6 component and should be called instead of accessing itemCommand6 field directly.//GEN-BEGIN:MVDGetBegin24
 * @return Instance for itemCommand6 component
 */
public Command get_itemCommand6() {
    if (itemCommand6 == null) {//GEN-END:MVDGetBegin24
            // Insert pre-init code here
        itemCommand6 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit24
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd24
    return itemCommand6;
}//GEN-END:MVDGetEnd24

/** This method returns instance for itemCommand7 component and should be called instead of accessing itemCommand7 field directly.//GEN-BEGIN:MVDGetBegin25
 * @return Instance for itemCommand7 component
 */
public Command get_itemCommand7() {
    if (itemCommand7 == null) {//GEN-END:MVDGetBegin25
            // Insert pre-init code here
        itemCommand7 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit25
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd25
    return itemCommand7;
}//GEN-END:MVDGetEnd25

/** This method returns instance for backCommand2 component and should be called instead of accessing backCommand2 field directly.//GEN-BEGIN:MVDGetBegin26
 * @return Instance for backCommand2 component
 */
public Command get_backCommand2() {
    if (backCommand2 == null) {//GEN-END:MVDGetBegin26
            // Insert pre-init code here
        backCommand2 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit26
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd26
    return backCommand2;
}//GEN-END:MVDGetEnd26

/** This method returns instance for backCommand3 component and should be called instead of accessing backCommand3 field directly.//GEN-BEGIN:MVDGetBegin27
 * @return Instance for backCommand3 component
 */
public Command get_backCommand3() {
    if (backCommand3 == null) {//GEN-END:MVDGetBegin27
            // Insert pre-init code here
        backCommand3 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit27
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd27
    return backCommand3;
}//GEN-END:MVDGetEnd27

/** This method returns instance for srcCommand4 component and should be called instead of accessing srcCommand4 field directly.//GEN-BEGIN:MVDGetBegin28
 * @return Instance for srcCommand4 component
 */
public Command get_srcCommand4() {
    if (srcCommand4 == null) {//GEN-END:MVDGetBegin28
            // Insert pre-init code here
        srcCommand4 = new Command("Source", Command.ITEM, 1);//GEN-LINE:MVDGetInit28
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd28
    return srcCommand4;
}//GEN-END:MVDGetEnd28

/** This method returns instance for drawCommand component and should be called instead of accessing drawCommand field directly.//GEN-BEGIN:MVDGetBegin29
 * @return Instance for drawCommand component
 */
public Command get_drawCommand() {
    if (drawCommand == null) {//GEN-END:MVDGetBegin29
            // Insert pre-init code here
        drawCommand = new Command("draw", Command.ITEM, 1);//GEN-LINE:MVDGetInit29
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd29
    return drawCommand;
}//GEN-END:MVDGetEnd29

/** This method returns instance for graphBoard component and should be called instead of accessing graphBoard field directly.//GEN-BEGIN:MVDGetBegin30
 * @return Instance for graphBoard component
 */
public Command get_graphBoard() {
    if (graphBoard == null) {//GEN-END:MVDGetBegin30
            // Insert pre-init code here
        graphBoard = new Command("Graphic Screen", Command.ITEM, 1);//GEN-LINE:MVDGetInit30
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd30
    return graphBoard;
}//GEN-END:MVDGetEnd30

/** This method returns instance for backCommand5 component and should be called instead of accessing backCommand5 field directly.//GEN-BEGIN:MVDGetBegin31
 * @return Instance for backCommand5 component
 */
public Command get_backCommand5() {
    if (backCommand5 == null) {//GEN-END:MVDGetBegin31
            // Insert pre-init code here
        backCommand5 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit31
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd31
    return backCommand5;
}//GEN-END:MVDGetEnd31

/** This method returns instance for backCommand6 component and should be called instead of accessing backCommand6 field directly.//GEN-BEGIN:MVDGetBegin32
 * @return Instance for backCommand6 component
 */
public Command get_backCommand6() {
    if (backCommand6 == null) {//GEN-END:MVDGetBegin32
            // Insert pre-init code here
        backCommand6 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit32
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd32
    return backCommand6;
}//GEN-END:MVDGetEnd32

/** This method returns instance for backCommand7 component and should be called instead of accessing backCommand7 field directly.//GEN-BEGIN:MVDGetBegin33
 * @return Instance for backCommand7 component
 */
public Command get_backCommand7() {
    if (backCommand7 == null) {//GEN-END:MVDGetBegin33
            // Insert pre-init code here
        backCommand7 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit33
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd33
    return backCommand7;
}//GEN-END:MVDGetEnd33

/** This method returns instance for screenCommand1 component and should be called instead of accessing screenCommand1 field directly.//GEN-BEGIN:MVDGetBegin34
 * @return Instance for screenCommand1 component
 */
public Command get_screenCommand1() {
    if (screenCommand1 == null) {//GEN-END:MVDGetBegin34
            // Insert pre-init code here
        screenCommand1 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit34
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd34
    return screenCommand1;
}//GEN-END:MVDGetEnd34

/** This method returns instance for okCommand1 component and should be called instead of accessing okCommand1 field directly.//GEN-BEGIN:MVDGetBegin35
 * @return Instance for okCommand1 component
 */
public Command get_okCommand1() {
    if (okCommand1 == null) {//GEN-END:MVDGetBegin35
            // Insert pre-init code here
        okCommand1 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit35
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd35
    return okCommand1;
}//GEN-END:MVDGetEnd35

/** This method returns instance for proceedCommand component and should be called instead of accessing proceedCommand field directly.//GEN-BEGIN:MVDGetBegin36
 * @return Instance for proceedCommand component
 */
public Command get_proceedCommand() {
    if (proceedCommand == null) {//GEN-END:MVDGetBegin36
            // Insert pre-init code here
        proceedCommand = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit36
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd36
    return proceedCommand;
}//GEN-END:MVDGetEnd36

/** This method returns instance for itemCommand9 component and should be called instead of accessing itemCommand9 field directly.//GEN-BEGIN:MVDGetBegin37
 * @return Instance for itemCommand9 component
 */
public Command get_itemCommand9() {
    if (itemCommand9 == null) {//GEN-END:MVDGetBegin37
            // Insert pre-init code here
        itemCommand9 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit37
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd37
    return itemCommand9;
}//GEN-END:MVDGetEnd37

/** This method returns instance for itemCommand10 component and should be called instead of accessing itemCommand10 field directly.//GEN-BEGIN:MVDGetBegin38
 * @return Instance for itemCommand10 component
 */
public Command get_itemCommand10() {
    if (itemCommand10 == null) {//GEN-END:MVDGetBegin38
            // Insert pre-init code here
        itemCommand10 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit38
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd38
    return itemCommand10;
}//GEN-END:MVDGetEnd38

/** This method returns instance for screenCommand2 component and should be called instead of accessing screenCommand2 field directly.//GEN-BEGIN:MVDGetBegin39
 * @return Instance for screenCommand2 component
 */
public Command get_screenCommand2() {
    if (screenCommand2 == null) {//GEN-END:MVDGetBegin39
            // Insert pre-init code here
        screenCommand2 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit39
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd39
    return screenCommand2;
}//GEN-END:MVDGetEnd39

/** This method returns instance for grphxCommand component and should be called instead of accessing grphxCommand field directly.//GEN-BEGIN:MVDGetBegin40
 * @return Instance for grphxCommand component
 */
public Command get_grphxCommand() {
    if (grphxCommand == null) {//GEN-END:MVDGetBegin40
            // Insert pre-init code here
        grphxCommand = new Command("Graphics Screen", Command.ITEM, 1);//GEN-LINE:MVDGetInit40
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd40
    return grphxCommand;
}//GEN-END:MVDGetEnd40

/** This method returns instance for itemCommand8 component and should be called instead of accessing itemCommand8 field directly.//GEN-BEGIN:MVDGetBegin41
 * @return Instance for itemCommand8 component
 */
public Command get_itemCommand8() {
    if (itemCommand8 == null) {//GEN-END:MVDGetBegin41
            // Insert pre-init code here
        itemCommand8 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit41
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd41
    return itemCommand8;
}//GEN-END:MVDGetEnd41

/** This method returns instance for saveCommand component and should be called instead of accessing saveCommand field directly.//GEN-BEGIN:MVDGetBegin42
 * @return Instance for saveCommand component
 */
public Command get_saveCommand() {
    if (saveCommand == null) {//GEN-END:MVDGetBegin42
            // Insert pre-init code here
        saveCommand = new Command("Save", Command.ITEM, 1);//GEN-LINE:MVDGetInit42
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd42
    return saveCommand;
}//GEN-END:MVDGetEnd42

/** This method returns instance for cleanCommand component and should be called instead of accessing cleanCommand field directly.//GEN-BEGIN:MVDGetBegin43
 * @return Instance for cleanCommand component
 */
public Command get_cleanCommand() {
    if (cleanCommand == null) {//GEN-END:MVDGetBegin43
            // Insert pre-init code here
        cleanCommand = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit43
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd43
    return cleanCommand;
}//GEN-END:MVDGetEnd43

/** This method returns instance for stopCommand1 component and should be called instead of accessing stopCommand1 field directly.//GEN-BEGIN:MVDGetBegin44
 * @return Instance for stopCommand1 component
 */
public Command get_stopCommand1() {
    if (stopCommand1 == null) {//GEN-END:MVDGetBegin44
            // Insert pre-init code here
        stopCommand1 = new Command("Stop", Command.ITEM, 1);//GEN-LINE:MVDGetInit44
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd44
    return stopCommand1;
}//GEN-END:MVDGetEnd44

/** This method returns instance for okCommand2 component and should be called instead of accessing okCommand2 field directly.//GEN-BEGIN:MVDGetBegin45
 * @return Instance for okCommand2 component
 */
public Command get_okCommand2() {
    if (okCommand2 == null) {//GEN-END:MVDGetBegin45
            // Insert pre-init code here
        okCommand2 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit45
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd45
    return okCommand2;
}//GEN-END:MVDGetEnd45

/** This method returns instance for readCommand2 component and should be called instead of accessing readCommand2 field directly.//GEN-BEGIN:MVDGetBegin46
 * @return Instance for readCommand2 component
 */
public Command get_readCommand2() {
    if (readCommand2 == null) {//GEN-END:MVDGetBegin46
            // Insert pre-init code here
        readCommand2 = new Command("Read", Command.ITEM, 1);//GEN-LINE:MVDGetInit46
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd46
    return readCommand2;
}//GEN-END:MVDGetEnd46

/** This method returns instance for saveForm component and should be called instead of accessing saveForm field directly.//GEN-BEGIN:MVDGetBegin47
 * @return Instance for saveForm component
 */
public Form get_saveForm() {
    if (saveForm == null) {//GEN-END:MVDGetBegin47
            // Insert pre-init code here
        saveForm = new Form(null, new Item[] {get_saveTextField()});//GEN-BEGIN:MVDGetInit47
        saveForm.addCommand(get_okCommand3());
        saveForm.addCommand(get_cancelCommand1());
        saveForm.setCommandListener(this);//GEN-END:MVDGetInit47
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd47
    return saveForm;
}//GEN-END:MVDGetEnd47

/** This method returns instance for saveTextField component and should be called instead of accessing saveTextField field directly.//GEN-BEGIN:MVDGetBegin48
 * @return Instance for saveTextField component
 */
public TextField get_saveTextField() {
    if (saveTextField == null) {//GEN-END:MVDGetBegin48
            // Insert pre-init code here
        saveTextField = new TextField("File Name:", "", 120, TextField.ANY);//GEN-LINE:MVDGetInit48
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd48
    return saveTextField;
}//GEN-END:MVDGetEnd48

/** This method returns instance for okCommand3 component and should be called instead of accessing okCommand3 field directly.//GEN-BEGIN:MVDGetBegin49
 * @return Instance for okCommand3 component
 */
public Command get_okCommand3() {
    if (okCommand3 == null) {//GEN-END:MVDGetBegin49
            // Insert pre-init code here
        okCommand3 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit49
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd49
    return okCommand3;
}//GEN-END:MVDGetEnd49

/** This method returns instance for cancelCommand1 component and should be called instead of accessing cancelCommand1 field directly.//GEN-BEGIN:MVDGetBegin51
 * @return Instance for cancelCommand1 component
 */
public Command get_cancelCommand1() {
    if (cancelCommand1 == null) {//GEN-END:MVDGetBegin51
            // Insert pre-init code here
        cancelCommand1 = new Command("Cancel", Command.CANCEL, 1);//GEN-LINE:MVDGetInit51
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd51
    return cancelCommand1;
}//GEN-END:MVDGetEnd51

/** This method returns instance for backCommand4 component and should be called instead of accessing backCommand4 field directly.//GEN-BEGIN:MVDGetBegin53
 * @return Instance for backCommand4 component
 */
public Command get_backCommand4() {
    if (backCommand4 == null) {//GEN-END:MVDGetBegin53
            // Insert pre-init code here
        backCommand4 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit53
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd53
    return backCommand4;
}//GEN-END:MVDGetEnd53

/** This method returns instance for readCommand3 component and should be called instead of accessing readCommand3 field directly.//GEN-BEGIN:MVDGetBegin55
 * @return Instance for readCommand3 component
 */
public Command get_readCommand3() {
    if (readCommand3 == null) {//GEN-END:MVDGetBegin55
            // Insert pre-init code here
        readCommand3 = new Command("Read", Command.ITEM, 1);//GEN-LINE:MVDGetInit55
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd55
    return readCommand3;
}//GEN-END:MVDGetEnd55

/** This method returns instance for menuScreen component and should be called instead of accessing menuScreen field directly.//GEN-BEGIN:MVDGetBegin57
 * @return Instance for menuScreen component
 */
public List get_menuScreen() {
    if (menuScreen == null) {//GEN-END:MVDGetBegin57
            // Insert pre-init code here
        menuScreen = new List("CellularBASIC v1.0(RK2.5)", Choice.IMPLICIT, new String[] {//GEN-BEGIN:MVDGetInit57
            "Copyright (C) 2006. Mustafa Elsheikh",
            "New",
            "Run",
            "Stop",
            "Source",
            "Graphics Screen",
            "Output Screen",
            "Load",
            "Save",
            "Help",
            "Exit"
        }, new Image[] {
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null
        });
        menuScreen.setCommandListener(this);
        menuScreen.setSelectedFlags(new boolean[] {
            false,
            false,
            false,
            false,
            false,
            false,
            false,
            false,
            false,
            false,
            false
        });//GEN-END:MVDGetInit57
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd57
    return menuScreen;
}//GEN-END:MVDGetEnd57

/** This method returns instance for itemCommand11 component and should be called instead of accessing itemCommand11 field directly.//GEN-BEGIN:MVDGetBegin77
 * @return Instance for itemCommand11 component
 */
public Command get_itemCommand11() {
    if (itemCommand11 == null) {//GEN-END:MVDGetBegin77
            // Insert pre-init code here
        itemCommand11 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit77
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd77
    return itemCommand11;
}//GEN-END:MVDGetEnd77

/** This method returns instance for menuCommand1 component and should be called instead of accessing menuCommand1 field directly.//GEN-BEGIN:MVDGetBegin78
 * @return Instance for menuCommand1 component
 */
public Command get_menuCommand1() {
    if (menuCommand1 == null) {//GEN-END:MVDGetBegin78
            // Insert pre-init code here
        menuCommand1 = new Command("Menu", Command.CANCEL, 1);//GEN-LINE:MVDGetInit78
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd78
    return menuCommand1;
}//GEN-END:MVDGetEnd78

/** This method returns instance for menuCommand2 component and should be called instead of accessing menuCommand2 field directly.//GEN-BEGIN:MVDGetBegin80
 * @return Instance for menuCommand2 component
 */
public Command get_menuCommand2() {
    if (menuCommand2 == null) {//GEN-END:MVDGetBegin80
            // Insert pre-init code here
        menuCommand2 = new Command("Menu", Command.CANCEL, 1);//GEN-LINE:MVDGetInit80
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd80
    return menuCommand2;
}//GEN-END:MVDGetEnd80

/** This method returns instance for backCommand8 component and should be called instead of accessing backCommand8 field directly.//GEN-BEGIN:MVDGetBegin86
 * @return Instance for backCommand8 component
 */
public Command get_backCommand8() {
    if (backCommand8 == null) {//GEN-END:MVDGetBegin86
            // Insert pre-init code here
        backCommand8 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit86
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd86
    return backCommand8;
}//GEN-END:MVDGetEnd86

/** This method returns instance for backCommand9 component and should be called instead of accessing backCommand9 field directly.//GEN-BEGIN:MVDGetBegin87
 * @return Instance for backCommand9 component
 */
public Command get_backCommand9() {
    if (backCommand9 == null) {//GEN-END:MVDGetBegin87
            // Insert pre-init code here
        backCommand9 = new Command("Back", Command.BACK, 1);//GEN-LINE:MVDGetInit87
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd87
    return backCommand9;
}//GEN-END:MVDGetEnd87

/** This method returns instance for cancelCommand2 component and should be called instead of accessing cancelCommand2 field directly.//GEN-BEGIN:MVDGetBegin88
 * @return Instance for cancelCommand2 component
 */
public Command get_cancelCommand2() {
    if (cancelCommand2 == null) {//GEN-END:MVDGetBegin88
            // Insert pre-init code here
        cancelCommand2 = new Command("Cancel", Command.CANCEL, 1);//GEN-LINE:MVDGetInit88
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd88
    return cancelCommand2;
}//GEN-END:MVDGetEnd88

/** This method returns instance for helpCommand1 component and should be called instead of accessing helpCommand1 field directly.//GEN-BEGIN:MVDGetBegin89
 * @return Instance for helpCommand1 component
 */
public Command get_helpCommand1() {
    if (helpCommand1 == null) {//GEN-END:MVDGetBegin89
            // Insert pre-init code here
        helpCommand1 = new Command("Help", Command.HELP, 1);//GEN-LINE:MVDGetInit89
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd89
    return helpCommand1;
}//GEN-END:MVDGetEnd89

/** This method returns instance for okCommand4 component and should be called instead of accessing okCommand4 field directly.//GEN-BEGIN:MVDGetBegin90
 * @return Instance for okCommand4 component
 */
public Command get_okCommand4() {
    if (okCommand4 == null) {//GEN-END:MVDGetBegin90
            // Insert pre-init code here
        okCommand4 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit90
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd90
    return okCommand4;
}//GEN-END:MVDGetEnd90

/** This method returns instance for screenCommand3 component and should be called instead of accessing screenCommand3 field directly.//GEN-BEGIN:MVDGetBegin91
 * @return Instance for screenCommand3 component
 */
public Command get_screenCommand3() {
    if (screenCommand3 == null) {//GEN-END:MVDGetBegin91
            // Insert pre-init code here
        screenCommand3 = new Command("Screen", Command.SCREEN, 1);//GEN-LINE:MVDGetInit91
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd91
    return screenCommand3;
}//GEN-END:MVDGetEnd91

/** This method returns instance for okCommand5 component and should be called instead of accessing okCommand5 field directly.//GEN-BEGIN:MVDGetBegin92
 * @return Instance for okCommand5 component
 */
public Command get_okCommand5() {
    if (okCommand5 == null) {//GEN-END:MVDGetBegin92
            // Insert pre-init code here
        okCommand5 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit92
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd92
    return okCommand5;
}//GEN-END:MVDGetEnd92
 
/** This method returns instance for Goto component and should be called instead of accessing Goto field directly.//GEN-BEGIN:MVDGetBegin95
 * @return Instance for Goto component
 */
public Command get_Goto() {
    if (Goto == null) {//GEN-END:MVDGetBegin95
            // Insert pre-init code here
        Goto = new Command("Goto", Command.OK, 2);//GEN-LINE:MVDGetInit95
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd95
    return Goto;
}//GEN-END:MVDGetEnd95

/** This method returns instance for itemCommand12 component and should be called instead of accessing itemCommand12 field directly.//GEN-BEGIN:MVDGetBegin98
 * @return Instance for itemCommand12 component
 */
public Command get_itemCommand12() {
    if (itemCommand12 == null) {//GEN-END:MVDGetBegin98
            // Insert pre-init code here
        itemCommand12 = new Command("Goto", "Goto Line Number", Command.ITEM, 2);//GEN-LINE:MVDGetInit98
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd98
    return itemCommand12;
}//GEN-END:MVDGetEnd98

/** This method returns instance for JumpingForm component and should be called instead of accessing JumpingForm field directly.//GEN-BEGIN:MVDGetBegin99
 * @return Instance for JumpingForm component
 */
public Form get_JumpingForm() {
    if (JumpingForm == null) {//GEN-END:MVDGetBegin99
            // Insert pre-init code here
        JumpingForm = new Form("Jumping Around", new Item[] {//GEN-BEGIN:MVDGetInit99
            get_GotoLineField(),
            get_SearchStringField()
        });
        JumpingForm.addCommand(get_cancelCommand3());
        JumpingForm.addCommand(get_Goto());
        JumpingForm.addCommand(get_Search());
        JumpingForm.addCommand(get_FindNext1());
        JumpingForm.setCommandListener(this);//GEN-END:MVDGetInit99
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd99
    return JumpingForm;
}//GEN-END:MVDGetEnd99
 
/** This method returns instance for okCommand6 component and should be called instead of accessing okCommand6 field directly.//GEN-BEGIN:MVDGetBegin101
 * @return Instance for okCommand6 component
 */
public Command get_okCommand6() {
    if (okCommand6 == null) {//GEN-END:MVDGetBegin101
            // Insert pre-init code here
        okCommand6 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit101
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd101
    return okCommand6;
}//GEN-END:MVDGetEnd101

/** This method returns instance for cancelCommand3 component and should be called instead of accessing cancelCommand3 field directly.//GEN-BEGIN:MVDGetBegin103
 * @return Instance for cancelCommand3 component
 */
public Command get_cancelCommand3() {
    if (cancelCommand3 == null) {//GEN-END:MVDGetBegin103
            // Insert pre-init code here
        cancelCommand3 = new Command("Cancel", Command.CANCEL, 1);//GEN-LINE:MVDGetInit103
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd103
    return cancelCommand3;
}//GEN-END:MVDGetEnd103
 
/** This method returns instance for itemCommand13 component and should be called instead of accessing itemCommand13 field directly.//GEN-BEGIN:MVDGetBegin106
 * @return Instance for itemCommand13 component
 */
public Command get_itemCommand13() {
    if (itemCommand13 == null) {//GEN-END:MVDGetBegin106
            // Insert pre-init code here
        itemCommand13 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit106
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd106
    return itemCommand13;
}//GEN-END:MVDGetEnd106

/** This method returns instance for itemCommand14 component and should be called instead of accessing itemCommand14 field directly.//GEN-BEGIN:MVDGetBegin107
 * @return Instance for itemCommand14 component
 */
public Command get_itemCommand14() {
    if (itemCommand14 == null) {//GEN-END:MVDGetBegin107
            // Insert pre-init code here
        itemCommand14 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit107
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd107
    return itemCommand14;
}//GEN-END:MVDGetEnd107

/** This method returns instance for itemCommand15 component and should be called instead of accessing itemCommand15 field directly.//GEN-BEGIN:MVDGetBegin108
 * @return Instance for itemCommand15 component
 */
public Command get_itemCommand15() {
    if (itemCommand15 == null) {//GEN-END:MVDGetBegin108
            // Insert pre-init code here
        itemCommand15 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit108
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd108
    return itemCommand15;
}//GEN-END:MVDGetEnd108

/** This method returns instance for itemCommand16 component and should be called instead of accessing itemCommand16 field directly.//GEN-BEGIN:MVDGetBegin109
 * @return Instance for itemCommand16 component
 */
public Command get_itemCommand16() {
    if (itemCommand16 == null) {//GEN-END:MVDGetBegin109
            // Insert pre-init code here
        itemCommand16 = new Command("Item", Command.ITEM, 1);//GEN-LINE:MVDGetInit109
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd109
    return itemCommand16;
}//GEN-END:MVDGetEnd109

/** This method returns instance for Search component and should be called instead of accessing Search field directly.//GEN-BEGIN:MVDGetBegin110
 * @return Instance for Search component
 */
public Command get_Search() {
    if (Search == null) {//GEN-END:MVDGetBegin110
            // Insert pre-init code here
        Search = new Command("Find", Command.ITEM, 3);//GEN-LINE:MVDGetInit110
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd110
    return Search;
}//GEN-END:MVDGetEnd110

/** This method returns instance for FindNext component and should be called instead of accessing FindNext field directly.//GEN-BEGIN:MVDGetBegin112
 * @return Instance for FindNext component
 */
public Command get_FindNext() {
    if (FindNext == null) {//GEN-END:MVDGetBegin112
            // Insert pre-init code here
        FindNext = new Command("Find Next", Command.ITEM, 1);//GEN-LINE:MVDGetInit112
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd112
    return FindNext;
}//GEN-END:MVDGetEnd112

/** This method returns instance for FindNext1 component and should be called instead of accessing FindNext1 field directly.//GEN-BEGIN:MVDGetBegin114
 * @return Instance for FindNext1 component
 */
public Command get_FindNext1() {
    if (FindNext1 == null) {//GEN-END:MVDGetBegin114
            // Insert pre-init code here
        FindNext1 = new Command("FindNext", Command.ITEM, 4);//GEN-LINE:MVDGetInit114
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd114
    return FindNext1;
}//GEN-END:MVDGetEnd114

/** This method returns instance for GotoLineField component and should be called instead of accessing GotoLineField field directly.//GEN-BEGIN:MVDGetBegin116
 * @return Instance for GotoLineField component
 */
public TextField get_GotoLineField() {
    if (GotoLineField == null) {//GEN-END:MVDGetBegin116
            // Insert pre-init code here
        GotoLineField = new TextField("Goto Line", "", 20, TextField.NUMERIC);//GEN-LINE:MVDGetInit116
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd116
    return GotoLineField;
}//GEN-END:MVDGetEnd116

/** This method returns instance for SearchStringField component and should be called instead of accessing SearchStringField field directly.//GEN-BEGIN:MVDGetBegin117
 * @return Instance for SearchStringField component
 */
public TextField get_SearchStringField() {
    if (SearchStringField == null) {//GEN-END:MVDGetBegin117
            // Insert pre-init code here
        SearchStringField = new TextField("Search String", "", 120, TextField.ANY | TextField.NON_PREDICTIVE);//GEN-LINE:MVDGetInit117
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd117
    return SearchStringField;
}//GEN-END:MVDGetEnd117

/** This method returns instance for cancelCommand4 component and should be called instead of accessing cancelCommand4 field directly.//GEN-BEGIN:MVDGetBegin119
 * @return Instance for cancelCommand4 component
 */
public Command get_cancelCommand4() {
    if (cancelCommand4 == null) {//GEN-END:MVDGetBegin119
            // Insert pre-init code here
        cancelCommand4 = new Command("Cancel", Command.CANCEL, 1);//GEN-LINE:MVDGetInit119
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd119
    return cancelCommand4;
}//GEN-END:MVDGetEnd119

/** This method returns instance for FindNext2 component and should be called instead of accessing FindNext2 field directly.//GEN-BEGIN:MVDGetBegin121
 * @return Instance for FindNext2 component
 */
public Command get_FindNext2() {
    if (FindNext2 == null) {//GEN-END:MVDGetBegin121
            // Insert pre-init code here
        FindNext2 = new Command("Find Next", Command.ITEM, 3);//GEN-LINE:MVDGetInit121
            // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd121
    return FindNext2;
}//GEN-END:MVDGetEnd121

/** This method returns instance for okCommand7 component and should be called instead of accessing okCommand7 field directly.//GEN-BEGIN:MVDGetBegin123
 * @return Instance for okCommand7 component
 */
public Command get_okCommand7() {
    if (okCommand7 == null) {//GEN-END:MVDGetBegin123
        // Insert pre-init code here
        okCommand7 = new Command("Ok", Command.OK, 1);//GEN-LINE:MVDGetInit123
        // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd123
    return okCommand7;
}//GEN-END:MVDGetEnd123

/** This method returns instance for Save component and should be called instead of accessing Save field directly.//GEN-BEGIN:MVDGetBegin125
 * @return Instance for Save component
 */
public Command get_Save() {
    if (Save == null) {//GEN-END:MVDGetBegin125
        // Insert pre-init code here
        Save = new Command("Save", Command.ITEM, 1);//GEN-LINE:MVDGetInit125
        // Insert post-init code here
    }//GEN-BEGIN:MVDGetEnd125
    return Save;
}//GEN-END:MVDGetEnd125
    
    public void startApp() {
        display = Display.getDisplay(this);
        if (srcTextBox == null) {
            initialize(); // setup all
            prepareNew(); // new clear source editor
        }
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
    
    public void run() {
        outTextField.setString(""); // clear output screen
        WorkSpace.outTextBuffer = new StringBuffer(); // clear graphix screen text buffer
        takeOff(); // vvooooooooooooooooooooooo...
        // blah blah
    }
    
    public synchronized void enter() {
        WorkSpace.inReady = true;
    }
    
    public void prepareNew() {
        // clear text/graphix screens
        srcTextBox.setString("");
        (gScreen = new GraphixScreen(this)).cls();
        // new workspace
        WorkSpace.initialize(getThis());
        WorkSpace.outTextField = get_outTextField();
        WorkSpace.inTextField = get_inTextField();
    }
    
    public void cr() {
        srcTextBox.insert("\n", srcTextBox.getCaretPosition());
    }
    
    public CellularBASIC getThis() {
        return this;
    }
    
    public void takeOff() {
        // gogo: user-frienldy status bar
        final Gauge gogo = new Gauge("Loading..", false, 100, 10);
        Form interimForm = new Form("CellularBASIC", new Item[] {gogo});
        //interimForm.addCommand(stopCommand1);
        Display.getDisplay(this).setCurrent(interimForm);
        srcTextBox.setTicker(null);
        gogo.setValue(gogo.getValue() + 10);
        pilotThread = new Thread("takeOff") {
            public void run() {
                try {
                    WorkSpace.procSpace.remove("__ENTRYP__"); // new __ENTRYP__
                    gogo.setValue(gogo.getValue() + 10);
                    // read source code ...
                    ByteArrayInputStream bais = new ByteArrayInputStream(srcTextBox.getString().getBytes());
                    parser = new Parser(new InputStreamReader(bais));
                    gogo.setValue(gogo.getValue() + 10);
                    gogo.setLabel("Parsing..");
                    // ... parse ...
                    parser.yyparse();
                    gogo.setValue(gogo.getValue() + 30);
                    gogo.setLabel("Executing..");
                    // ... reset falgs ...
                    WorkSpace.inReady = false;
                    WorkSpace.breakFlag = false;
                    WorkSpace.contFlag = false;
                    WorkSpace.paramNumber = 0;
                    WorkSpace.fill = false;
                    display.setCurrent(get_outForm());
                    // ... execute __ENTRP__ ...
                    if (WorkSpace.procSpace.containsKey("__ENTRYP__") == true) {
                        ((Node)WorkSpace.getProc("__ENTRYP__")).exec();
                    } else {
                        // ... or procedure MAIN ...
                        ((Node)WorkSpace.getProc("main")).exec();
                    }
                    // ... finally, print READY.
                    if (gScreen.isShown() == true) { WorkSpace.printG("\nREADY.");
                     } else { WorkSpace.print("\nREADY."); }
                } catch (Exception e) {
                    JumpTo(WorkSpace.ErrorLine, WorkSpace.ErrorColumn, srcTextBox);
                    srcTextBox.setTicker(new Ticker(WorkSpace.ErrorMessage));
                    display.setCurrent(get_outForm());
                    display.setCurrent(new Alert("takeOff",e.toString(), null, null));
                    e.printStackTrace();
                }
            }
        };
        pilotThread.start(); // fire
    }
    
    public void prepareSave() {
        Thread t = new Thread() {
            public void run() {
                try {
                    // open specified file ...
                    FileConnection fc = (FileConnection) Connector.open("file:///store/home/user/zam/" + saveTextField.getString(), Connector.READ_WRITE);
                    // ... if not exist , create it ...
                    if (fc.exists() == false) { fc.create(); }
                    OutputStream out = fc.openOutputStream();
                    byte[] bb = srcTextBox.getString().getBytes();
                    // ... write all source code into the file ...
                    out.write(bb);
                    out.flush();
                    out.close();
                    fc.close();
                    // ... flush and close
                } catch (Exception e) { 
                    e.printStackTrace(); 
                    display.setCurrent(new Alert("prepareSave",e.toString(), null, null)); 
                }
            }
        };
        t.start();
        display.setCurrent(srcTextBox);
    }
    
    public void prepareLoad() {
        Thread t = new Thread() {
            public void run() {
                try {
                    // open specified location file:///e/zam/ ...
                    FileConnection fc = (FileConnection) Connector.open(WorkSpace.fsroot);
                    Enumeration e = fc.list();
                    // delete current list entries
                    fileList.deleteAll();
                    // fill the list with directory contents
                    while (e.hasMoreElements()) {
                        fileList.append((String) e.nextElement(), null);
                    }
                } catch(Exception e) { 
                    WorkSpace.fsroot = "file:///store/home/user/zam/"; 
                    FileConnection fsrootFolder = null;
                    try { 
                        fsrootFolder = (FileConnection)Connector.open(WorkSpace.fsroot); 
                    } catch (Exception f) {
                        display.setCurrent(new Alert("load1",f.toString(), null, null));
                    }
                    if (!fsrootFolder.exists()) {
                        try {
                            fsrootFolder.mkdir();
                        } catch (Exception g) {
                            display.setCurrent(new Alert("load2",g.toString(),null,null));
                        }
                    }
                    prepareLoad(); 
                    display.setCurrent(new Alert("load3",e.toString(), null, null));
                }
            }
        };
        t.start();
    }
    
    public void read() {
        Thread t = new Thread() {
            public void run() {
                try {
                    // open specified file ...
                    FileConnection fc = (FileConnection) Connector.open(WorkSpace.fsroot + fileList.getString(fileList.getSelectedIndex()));
                    // if directoy, browse to it
                    if (fc.isDirectory() == true) { WorkSpace.fsroot = fc.getURL(); prepareLoad(); return; }
                    InputStream in = fc.openInputStream();
                    StringBuffer text = new StringBuffer();
                    byte[] bb = new byte[1];
                    // read the file
                    while( in.read(bb) != -1 ) {
                        if ((char)bb[0] == '\r') { continue; }
                        text.append(new String(bb));
                    }
                    display.setCurrent(new Alert("read",
                            "reading "+text.length()+" bytes into "+srcTextBox.getMaxSize(),
                            null,null));
                    // write contents into srcTxtBox
                    srcTextBox.setTitle(fc.getName());
                    srcTextBox.setString(text.toString());
                    get_saveTextField().setString(fc.getName());
                    srcTextBox.insert("", 0);
                    display.setCurrent(srcTextBox);
                } catch (Exception e) { 
                    e.printStackTrace(); 
                    display.setCurrent(new Alert("read "+srcTextBox.getMaxSize(), 
                                        e.toString(), null, null)); 
                }
            }
        };
        t.start();
    }
    
    public void stop() {
        //Thread.currentThread().yield();
    }

    /**
     * Holds value of property gotoLine.
     */
    private long gotoLine;

    /**
     * Getter for property gotoLine.
     * @return Value of property gotoLine.
     */
    public long getGotoLine() {
        return this.gotoLine;
    }

    /**
     * Setter for property gotoLine.
     * @param gotoLine New value of property gotoLine.
     */
    public void setGotoLine(long gotoLine) {
        this.gotoLine = gotoLine;
    }

    /**
     * Holds value of property searchString.
     */
    private String searchString;

    /**
     * Getter for property searchString.
     * @return Value of property searchString.
     */
    public String getSearchString() {
        return this.searchString;
    }

    /**
     * Setter for property searchString.
     * @param searchString New value of property searchString.
     */
    public void setSearchString(String searchString) {
        this.searchString = searchString;
    }

    private long GotoLine = 0;
}
